<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__user">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-select v-model="dataForm.mqType" clearable  placeholder="状态">
            <el-option label="添加失败" value="0"></el-option>
            <el-option label="添加成功" value="1"></el-option>
            <el-option label="消费成功" value="2"></el-option>
            <el-option label="消费失败" value="3"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input v-model="dataForm.merchantName" placeholder="商户名称" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList(1)">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
          v-loading="dataListLoading"
          :data="dataList"
          border
          size="mini"
          :height="tableHeight"
          @selection-change="dataListSelectionChangeHandle"
          @sort-change="dataListSortChangeHandle"
          style="width: 100%;">
        <!--<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>-->
        <el-table-column prop="orderBillsId" label="缴费单号" sortable="custom" header-align="center" align="center"></el-table-column>
        <el-table-column prop="memchantName" label="商户名称" header-align="center" align="center"></el-table-column>
        <el-table-column prop="mqType" label="状态" sortable="custom" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.mqType === '0'" size="small" type="danger">添加失败</el-tag>
            <el-tag v-if="scope.row.mqType === '1'" size="small" type="success">添加成功</el-tag>
            <el-tag v-if="scope.row.mqType === '2'" size="small" type="success">消费成功</el-tag>
            <el-tag v-if="scope.row.mqType === '3'" size="small" type="danger">消费失败</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间" sortable="custom" header-align="center" align="center"  width="180"></el-table-column>
      </el-table>
      <el-pagination
          :current-page="current"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/affair/list',
        getDataListIsPage: true
      },
      dataForm: {
        merchantId: this.$store.state.user.merchantId ? this.$store.state.user.merchantId : 0,
        merchantName: '',
        mqType: ''
      }
    }
  },
  components: {
  }
}
</script>
